<div id="main_container">
	{$oZoneHeader}
    <div class="main_content">
        {$oZoneTopMenu}
        <div class="center_content">  
            <div class="left_content">
                {$oZoneLeftMenu}
                {$oZoneGammeLeft}
            </div>
    
        <div class="right_content">
                <form id="createForm" class="Gmodeles" action="{jurl 'essais~BoGamme:saveModele'}" method="post">
                <input type="hidden" value=""  name="chapNameId"/>
                <input type="hidden" name="gammeModeleId" value="{$gammeModeleDetail->chap_modele}" />
                <input type="hidden" name="marqueId" value="{$oEssai->ess_iMarqueId}" />
                <input type="hidden" value="{$oEssai->ess_id}"  name="ess_id"/>
                <h2>LES MODELES</h2> 
                  
                  <dl>
                    <dt><label>Modèle : </label></dt>
                    <dd>
                     <select name="modele-id" validation="required" id="chap-title-list">
                            {foreach $listeModeleParMarque as $item}
                                {if $item->modele_id == $gammeModeleDetail->chap_modele} 
                                      {assign $selected='selected="selected"'}
                                 {else}
                                      {assign $selected=''}
                                {/if}
                               <option value="{$item->modele_id} " {$selected} >{$item->modele_libelle}</option>
                            {/foreach}
                    </select>
                    </dd>
                  </dl>
                  <dl>
                    <dt><label>Titre : </label></dt>
                    <dd>
                        <input type="text" name="modele-titre" value="{if isset($gammeModeleDetail->chap_name)}{$gammeModeleDetail->chap_name}{else}{$gammeModeleDetail->chap_titre}{/if}" />
                    </dd>
                  </dl>
                  <dl style="height:auto">
                    <dt><label>Texte : </label></dt>
                    <dd style="width:600px;">
                        <textarea id="ess_zChapeau" name="modele-txt" >{$gammeModeleDetail->chap_content}</textarea>
                        <script type="text/javascript">
                            {literal}CKEDITOR.replace( 'ess_zChapeau', {width:'600px', toolbar:'AOToolbar'}) ;{/literal}
                        </script>
                    </dd>
                  </dl>

                  <dl style="height:auto">
                    <dt><label>Illustrations stockées : </label></dt><br />
                                      
                    <!-- photos  -->
                    <div class="wrap">
                        <div class="p1">
                            <input type="hidden" name="chapId" value="{$gammeModeleDetail->chap_id}" />

                            <input type="hidden" name="photo-annonce" value="{if isset($gammeModeleDetail->image) && sizeof($gammeModeleDetail->image)}{foreach $gammeModeleDetail->image as $key=>$item}{if ($key >0)},{/if}{$item}{/foreach}{/if}" id="photo-annonce" />
                            <div class="upload_image">
                                <img src="{$j_basepath}design/front/images/no_image.jpg" id="thumb" alt="no image"/>
                                <!--chemin du fichier-->
                                <input type="text" id="fic" name="fic"  class="nom" readonly="true" value=""/>
                                <!-- Upload Button-->
                                <div id="upload" class='btn_upload'>Parcourir</div>
                                <span id="status" >
                                    <img src="{$j_basepath}design/front/images/loading.gif" class="loading"  alt="no image"/>
                                    <p></p>
                                </span> 
                            </div>
                            <!-- open kcfinder -->
                            <input type="hidden" value="{$path_img}" id="path_img" />
                            {literal}
                            <script type="text/javascript">

                                function openKCFinder(field) {
                                    window.KCFinder = {
                                        callBack: function(url) {
                                            window.KCFinder = null;
                                            // field.value = url;
                                            field.val(url) ;
                                            addImageinCarousel(url);
                                        }
                                    };
                                    img_path = $("#path_img").val();
                                    window.open(j_basepath+'kcfinder/browse.php?type=images&dir='+ img_path, 'kcfinder_textbox',
                                        'status=0, toolbar=0, location=0, menubar=0, directories=0, ' +
                                        'resizable=1, scrollbars=0, width=800, height=600'
                                    );
                                }
                                $(function(){
                                    var cible = $('#fic');
                                    imageName = cible.val();
                                    $('#upload').click(function(){
                                        openKCFinder (cible) ;
                                    });
                                    
                                });
                            </script>
                            {/literal}
                            <!-- fin kcfinder -->

                        </div>

                        <!--begin gallery-->
                       <div class="infiniteCarousel">
                            <div class="wrapper">
                                <ul>
                                    {if isset($gammeModeleDetail->image) && sizeof($gammeModeleDetail->image)}
                                        {assign $imgP = PATH_ESSAI_IMG}
                                        {foreach $gammeModeleDetail->image as $k=>$item2}
                                             <li>
                                                {assign $gm = $gammeModeleDetail->withoutConst}
                                                {if $gm[$k]}
                                                    {assign $currentPath = $item2}
                                                {else}
                                                    {assign $currentPath = $imgP . $item2}
                                                {/if}
                                                    <img src="{$currentPath}" title="{$currentPath}" width="84" />
                                                    <img src="{$j_basepath}design/front/images/DeleteRed.png" class="deleteImage" title="Supprimer cette image" />
                                             </li>
                                        {/foreach}
                                    {/if}
                                </ul>        
                            </div>
                        </div>
                        <!--end gallery-->

                        <div class="clear">&nbsp;</div>
                    </div>
                    <!-- finphotos  -->
                    
                  </dl>
                 <dl class="submit">
                   <input class="valider" title="Valider" type="submit" value="" />
                 </dl>  

            </form>
            <div class="clear">&nbsp;</div>

            </div><!-- end of right content-->

             
        </div>   <!--end of center content -->               

        <div class="clear"></div>
    </div> <!--end of main content-->
	
    
    <div class="footer">
    </div>

</div>
<!-- popup de l'image d'une version-->
<div id="light" class="white_content">
		<a class="close" href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'">Fermer</a>
			<div class="apercu1" id="apercu"><img src="" alt="" id="apecu-img"></div>
</div>
<div id="fade" class="black_overlay"></div>

{literal}
    <style type="text/css">
		a#showFiabilite{float:right; width:250px;}
        #bloc-fiabilite {width:100%; float:left; clear:both;}
        #bloc-verion {width:59%; float:left;}
    </style>
    <script type="text/javascript">
        $(function () {
            $('#showFiabilite').click(function () {
                $('#fiabiliteGamme').show();
                $(this).hide();
            });

            // popup image dans version
            $('.img-pop').click(function () {
                image = $(this).attr('id')
                $('#apecu-img').attr('src', image);
            });
        });
    </script>
{/literal}
